package Text2;

/*
 *@Student 张策
 */
public class Person {
    private String name;
    private Vehicles vehicles;

    public Person(String name, Vehicles vehicles) {
        this.name = name;
        this.vehicles = vehicles;
    }
    public void pass(){
        if(!(vehicles instanceof Boat)){
           vehicles = Facktork.getBoat();
        }
        vehicles.work();
    }
    public void comm(){
        if(!(vehicles instanceof Horse)){
            vehicles = Facktork.getHouse();
        }
        vehicles.work();
    }
    public void shan(){
        if(!(vehicles instanceof AreFly)){
            vehicles=Facktork.getFly();
        }
        vehicles.work();
    }
}
